package com.mazaiting.redeye.controller;

import com.mazaiting.redeye.base.Base;
import com.mazaiting.redeye.config.GlobalConfig;
import com.mazaiting.redeye.domain.Request;
import com.mazaiting.redeye.domain.Response;
import com.mazaiting.redeye.domain.ResponseCode;
import com.mazaiting.redeye.domain.WormBean;
import com.mazaiting.redeye.service.WormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/***
 *
 *
 *                                                    __----~~~~~~~~~~~------___
 *                                   .  .   ~~//====......          __--~ ~~
 *                   -.            \_|//     |||\\  ~~~~~~::::... /~
 *                ___-==_       _-~o~  \/    |||  \\            _/~~-
 *        __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~
 *    _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /
 *  .~       .~       |   \\ -_    /  /-   /   ||      \   /
 * /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /
 * |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\
 *          '         ~-|      /|    |-~\~~       __--~~
 *                      |-~~-_/ |    |   ~\_   _-~            /\
 *                           /  \     \__   \/~                \__
 *                       _--~ _/ | .-~~____--~-/                  ~~==.
 *                      ((->/~   '.|||' -_|    ~~-/ ,              . _||
 *                                 -_     ~\      ~~---l__i__i__i--~~_/
 *                                 _-~-__   ~)  \--______________--~~
 *                               //.-~~~-~_--~- |-------~~~~~~~~
 *                                      //.-~~~--\
 *                               神兽保佑
 *                              代码无BUG!
 * @author mazaiting
 * @date 2019-07-05
 * @decription 图虫控制器
 */
@RestController
@RequestMapping(GlobalConfig.WORM)
public class WormController extends Base {
    /**
     * 图虫服务
     */
    private final WormService mTcService;

    @Autowired
    public WormController(WormService mTcService) {
        this.mTcService = mTcService;
    }

    /**
     * 获取 Tab 列表
     * @return Tab 列表
     */
    @PostMapping(GlobalConfig.WORM_MEDIA_LIST)
    public Response<List<String>> mediaList() {
//        mLog.debug("mediaList请求信息: " + request.toJson());
        List<String> list = new ArrayList<>();
        list.add("推荐");
        list.add("赤眼");
        return new Response<>(ResponseCode.SUCCESS, "获取成功", list);
    }

    /**
     * 获取图片数据
     */
    @PostMapping(GlobalConfig.WORM_FEED)
    public Response<List<WormBean.FeedBean>> feed() {
//        mLog.debug("feed请求信息: " + request.toJson());
        return mTcService.feed();
    }

    @Override
    protected Class<?> getChildClass() {
        return this.getClass();
    }
}
